//
// Created by tianq on 24-12-9.
//
#include <iostream>
#include <vector>
#include <random>
#include <unordered_map>
#include <algorithm>
#include <ranges>
using namespace std;

int main() {
    int n; // point count
    double k; // (closed) interval length
    vector<double> points; // coordinates of each point

    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        double tmp;
        cin >> tmp;
        points.emplace_back(tmp);
    }

    ranges::sort(points);
    unordered_map<double, int> map;
    map.emplace(points[0] + k, 1); // repeating the first point on init, this should have no effect

    for (const auto &pos: points) {
        unordered_map<double, int> newMap;
        for (const auto &[endPos, count]: map) {
            // start a new interval here, update interval count
            if (!newMap.contains(pos+k) || count + 1 < newMap[pos+k])
                newMap.emplace(pos+k, count + 1);
            // current interval can reach this point, keep this state unchanged
            if (endPos < pos) continue;
            newMap.emplace(endPos, count);
        }
        map.swap(newMap);
    }

    int minCount = numeric_limits<int>::max();
    for (const int &count: map | std::views::values) {
        minCount = min(minCount, count);
    }

    cout << minCount << endl;

    return 0;
}
